package com.jeesite.modules.dp.service.patternstatics;

import com.jeesite.common.service.CrudService;
import com.jeesite.modules.dp.dao.patrernstatics.PatternStaticsDao;
import com.jeesite.modules.dp.entity.patrernstatics.PatrernStaticsEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class PatternStaticsService extends CrudService<PatternStaticsDao, PatrernStaticsEntity> {

    @Autowired
    private PatternStaticsDao patternStaticsDao;

    /**
     * 查询日期最近的数据
     */
    public Map<String, Integer> findLatestStatics() {
        List<PatrernStaticsEntity> list = patternStaticsDao.getLatestDataList();
        Map<String, Integer> mr = new HashMap<>();
        for (PatrernStaticsEntity data : list) {
            mr.put("vcpCount", data.getVcpCount());
            mr.put("cupHandleCount", data.getCupHandleCount());
            mr.put("inverseHsCount", data.getInverseHsCount());
            mr.put("doubleBottomCount", data.getDoubleBottomCount());
            mr.put("wedgeCount", data.getWedgeCount());
            mr.put("triangleCount", data.getTriangleCount());
            mr.put("flagCount", data.getFlagCount());
            mr.put("pocketPointCount", data.getPocketPointCount());
            mr.put("wickCount", data.getWickCount());
            mr.put("gapCount", data.getGapCount());
        }
        return mr;
    }

}
